package sharewithus.analyzer.seg;

import java.util.List;

import sharewithus.analyzer.dic.Dictionary;
import sharewithus.analyzer.tag.Tagger;

public abstract class AbstractSegmenter implements SUSegmenter {

	protected static final Dictionary dic = Dictionary.getInstance();
	
	public List<SUToken> segment(String txt) {
		if (txt == null || txt.isEmpty())
			throw new IllegalArgumentException();
		//long start,end;
		//start = System.currentTimeMillis();
		List<SUToken> tokens = doSeg(txt);
		Tagger.hmm(tokens);
		//end = System.currentTimeMillis();
		//System.out.println("耗时:" + (end - start));
		return tokens;
	}
	
	protected abstract List<SUToken> doSeg(String txt);
}
